package com.example.springconfig.demos;

import com.example.springconfig.demos.component.BeanLifeComponent;
import com.example.springconfig.demos.model.User;
import com.sun.glass.ui.Application;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class SpringConfigApplication {

    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(SpringConfigApplication.class, args);
//        User user = context.getBean(User.class);
//        user.setName("lisi");
//        System.out.println(user);
//        System.out.println("当前对象地址"+System.identityHashCode(user));
//        User user2 = context.getBean(User.class);
//        System.out.println(user2);
//        System.out.println("当前对象地址"+System.identityHashCode(user2));
        BeanLifeComponent lifeComponent = context.getBean(BeanLifeComponent.class);
        lifeComponent.use();
    }

}
